﻿using personalplaner.business.enums;

namespace personalplaner.business.stamm
{
    public class Person : ItemBase
    {
        public override string ToString()
        {
            return string.Format("{0} {1}", Name, Nachname);
        }

		#region IDataErrorInfo Members

		/// <summary>
		/// Determines whether the specified property is valid.
		/// </summary>
		/// <param name="property">The name of the property.</param>
		/// <returns>
		/// if not valid the error message, otherwise null.
		/// </returns>
		protected override string IsPropertyValid(string property)
		{

			if (property == "Name")
			{
				if (string.IsNullOrWhiteSpace(Name))
					return string.Format("{0} ist leer.", property);
			}
			else if (property == "Nachname")
			{
				if (string.IsNullOrWhiteSpace(Nachname))
					return string.Format("{0} ist leer.", property);
			}
            //else if (property == "Strasse")
            //{
            //    if (string.IsNullOrWhiteSpace(Strasse))
            //        return string.Format("{0} ist leer.", property);
            //}
            //else if (property == "PLZ")
            //{
            //    if (string.IsNullOrWhiteSpace(PLZ))
            //        return string.Format("{0} ist leer.", property);
            //}
            //else if (property == "Ort")
            //{
            //    if (string.IsNullOrWhiteSpace(Ort))
            //        return string.Format("{0} ist leer.", property);
            //}

			return base.IsPropertyValid(property: property);
		}

		#endregion

		#region Properties

		public override int ID
        {
            get
            {
                return _prsid;
            }
            set
            {
                _prsid = value;
                RaisePropertyChanged("ID");
            }
        }

        int _prsid;
        public int PrsID
        {
            get
            {
                return _prsid;
            }
            set
            {
                _prsid = value;
                RaisePropertyChanged("PrsID");
            }
        }

        string _nachname;
        public string Nachname
        {
            get
            {
                return _nachname;
            }
            set
            {
                _nachname = value;
                RaisePropertyChanged("Nachname");
            }
        }

        string _strasse = "";
        public string Strasse
        {
            get
            {
                return _strasse;
            }
            set
            {
                _strasse = value;
                RaisePropertyChanged("Strasse");
            }
        }

        string _strassennr = "";
        public string StrassenNr
        {
            get
            {
                return _strassennr;
            }
            set
            {
                _strassennr = value;
                RaisePropertyChanged("StrassenNr");
            }
        }

        string _postfach = "";
        public string Postfach
        {
            get
            {
                return _postfach;
            }
            set
            {
                _postfach = value;
                RaisePropertyChanged("Postfach");
            }
        }

        string _plz = "";
        public string PLZ
        {
            get
            {
                return _plz;
            }
            set
            {
                _plz = value;
                RaisePropertyChanged("PLZ");
            }
        }

        string _ort = "";
        public string Ort
        {
            get
            {
                return _ort;
            }
            set
            {
                _ort = value;
                RaisePropertyChanged("Ort");
            }
        }

        string _telefonprivat = "";
        public string TelefonPrivat
        {
            get
            {
                return _telefonprivat;
            }
            set
            {
                _telefonprivat = value;
                RaisePropertyChanged("TelefonPrivat");
            }
        }

        string _natel = "";
        public string Natel
        {
            get
            {
                return _natel;
            }
            set
            {
                _natel = value;
                RaisePropertyChanged("Natel");
            }
        }

        string _email = "";
        public string EMail
        {
            get
            {
                return _email;
            }
            set
            {
                _email = value;
                RaisePropertyChanged("EMail");
            }
        }

        enPersonTyp _persontyp;
        public enPersonTyp PersonTyp
        {
            get
            {
                return _persontyp;
            }
            set
            {
                _persontyp = value;
				RaisePropertyChanged("PersonTyp");
            }
        }

        int _arbeitsPensum;
        public int ArbeitsPensum
        {
            get
            {
                return _arbeitsPensum;
            }
            set
            {
                _arbeitsPensum = value;
                RaisePropertyChanged("ArbeitsPensum");
            }
		}

        bool _showPrsId;
        public bool ShowPrsId
        {
            get
            {
                return _showPrsId;
            }
            set
            {
                _showPrsId = value;
                RaisePropertyChanged("ShowPrsId");
            }
        }

        enNameDisplay _nameDisplay = enNameDisplay.NameVorname;
        public enNameDisplay NameDisplay
        {
            get
            {
                return _nameDisplay;
            }
            set
            {
                _nameDisplay = value;
                RaisePropertyChanged("NameDisplay");
            }
        }

		#endregion
	}
}
